var arr1 = [1,2];
var arr2 = [3,4];
var arr3 = arr1.concat(arr2);
console.log(arr3);
// console.log(arr3.splice(1));
console.log(arr3.slice(-3,-2));
console.log(arr3);

// var arr4 = arr3.splice(1,2);
// console.log(arr4);
// console.log(arr3);

arr3.splice(2,1,"green");
console.log(arr3);


var arr = [1,2,3];
arr.push(4,5);
console.log(arr);
Array.prototype.push=function(){
    for(var i=0;i<arguments.length;i++){
        this[this.length]=arguments[i]*arguments[i];
    }
}
arr.push(6,7);
console.log(arr);



console.log("----------------------------------------");
var arrNew = [1,,3,null,5,undefined,7];
//打印所有元素
for(var i=0;i<arrNew.length;i++){
    console.log(arrNew[i]);
}
console.log("----------------------------------------");
//过滤empty空元素
for(var i in arrNew){
    console.log(arrNew[i]);
}
console.log("----------------------------------------");
//过滤null和undefined
for(var i in arrNew){
    if(arrNew[i]){
       console.log(arrNew[i]);
    }
}
console.log("----------------------------------------");
//过滤undefined
for(var i in arrNew){
    if(arrNew[i] === undefined){
        continue;
    }
    console.log(arrNew[i]);
}

Array.prototype.company = "NanTian";
arrNew.name="江苏";
console.log("----------------------------------------");
for(var i=0;i<arrNew.length;i++){
    console.log(i,arrNew[i]);
}

for(var in arrNew){
    
}